package realize.methodDemo;

import java.util.Arrays;

/**
 * @name 菠菜
 * @date 2024-06-18 16:25
 */
public class MethodArr {

    public int total(int[] arr){
        int he = 0;
        for (int i = 0; i < arr.length; i++) {
            he += arr[i];
        }
        return he;
    }
    public int sum(int... nums){
        int he = 0;
        for (int i = 0; i < nums.length; i++) {
            he += nums[i];
        }
        return he;
    }

    public String concat (char seperator, String... args){
        System.out.printf("args的值为=%s \n", Arrays.toString(args));
        String str = "";
        for (int i = 0; i < args.length; i++) {
            if (i==0){
                str += args[i];
            }else {
                str += seperator + args[i];
            }
        }
        return str;
    }
}
